import { Allow, IsNotEmpty } from 'class-validator'
import i18n from '@/i18n'
import { ApiProperty } from '@nestjs/swagger'

export class ActionSocketMessage<T = any, A extends string = string, C extends string = string> {
  @ApiProperty({ description: i18n.t('lhy-common.entity.action-socket-message.12153274-0') })
  @IsNotEmpty()
  action: A

  @ApiProperty({ description: i18n.t('lhy-common.entity.action-socket-message.12153274-1') })
  @IsNotEmpty()
  code?: C

  @ApiProperty({ description: i18n.t('lhy-common.entity.action-socket-message.12153274-2') })
  @Allow()
  data?: T | (() => T)
}
